﻿namespace IBTrader.Indicator.CandleStick
{
    using IBTrader.Charts;

    /// <summary>
    /// Average True Range (ATR) is an indicator that measures volatility
    /// </summary>
    class ATR : Base
    {
        public ATR(Worker worker, int interval = 60, int pinterval = 12) : base(worker, new ChartArgs { Group = 1 }, interval, pinterval) { }
        protected override void Add(object _, Item item)
        {
            Prices.Add(item.TrueRange((this as ILast).Last));
                OnHit(item.CloseLine, Prices.Average());
        }
    }
}
